package cn.gok.io;

import java.io.File;

public class File类 {


    public static void main(String[] args) {
        File file = new File("F:\\java_workspace\\day4\\src");
        File[] file1 = file.listFiles();
        for (File file2:file1){
            System.out.println("file:"+file2);
        }
        showDir(file);
    }

    private static void showDir(File file) {
       File file1[] = file.listFiles();
       for (File file2:file1){
           if (file2.isFile()){
               System.out.println("文件绝对路径:"+file2.getAbsolutePath());
           }else if (file2.isDirectory()){
               showDir(file2);
               System.out.println("目录绝对路径:"+file2.getAbsolutePath());
           }
       }
    }
}
